libxl: introduce libxl_fd_set_nonblock, rationalise _cloexec
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 27 Jan 2012 17:01:23 +0000 (17:01 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Fri, 27 Jan 2012 17:01:23 +0000 (17:01 +0000)
commit705fdc03cd7d78643c4dece8564d0bba04eb2c0f
treed892aa2ba7d71d68c2ef559704e64cb24cf53013
parent328eb1ab8ac325ea58110b68ec866f0f2fa05625
libxl: introduce libxl_fd_set_nonblock, rationalise _cloexec

We want a function for setting fds to nonblocking, so introduce one.

This is a very similar requirement to that for libxl_fd_set_cloexec,
so make it common with that.

While we're at it, fix a few deficiences that make this latter
function less desirable than it could be:
 * Change the return from 0/-1 (like a syscall) to a libxl error code
 * Take a boolean parameter for turning the flag on and off
 * Log on error (and so, take a ctx for this purpose)

Change callers of libxl_fd_set_cloexec to notice errors.  (Although,
such errors are highly unlikely.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
tools/libxl/libxl.c
tools/libxl/libxl.h
tools/libxl/libxl_qmp.c
tools/libxl/xl_cmdimpl.c